<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台主页模块 - XzcBlogTemplate后台管理</title>
    <link rel="stylesheet" href="static/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="static/admin/css/common.css">
    <link rel="stylesheet" type="text/css" href="static/admin/css/blogadd.css">
</head>
<body>
<div class="layui-container main">
    <div class="layui-row layui-col-space20">
        <div class="layui-col-md12">
            <p>
		        	<span class="layui-breadcrumb" style="visibility: visible;">
			          	<a href="bloglist.html">博客管理系统</a><span lay-separator="">/</span>
			          	<a href="bloglist.html">后台首页</a><span lay-separator="">/</span>
			          	<a><cite>博文编辑</cite></a>
		        	</span>
            </p>
        </div>
        <div class="layui-col-md12">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input max_width500">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">分类</label>
                    <div class="layui-input-block">
                        <select name="city" lay-verify="required">
                            <option value="" class="max_width500"></option>
                            <option value="1" class="max_width500">JAVA基础</option>
                            <option value="2" class="max_width500">数据库</option>
                            <option value="3" class="max_width500">JSP</option>
                            <option value="4" class="max_width500">框架</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">置顶</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="switch" lay-skin="switch" value="1">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">内容</label>
                    <div class="layui-input-block">
                        <textarea name="desc" placeholder="请输入内容" class="layui-textarea" id="editor" ></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button id="button" class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script src="static/js/jquery-1.12.4.min.js"></script>
<script src="static/layui/layui.all.js"></script>
<script src="static/admin/javascript/blogadd.js"></script>
<script>

    $(document).ready(function () {
        var blogid =sessionStorage.getItem('blogid');
        $.get("blog/findByblogid",{"blogid":blogid},function (rs) {
            var wos=rs.result;
            $("[name=\"title\"]").val(wos[0].title)

            $("[name=\"desc\"]").val(wos[0].detail)
        });
        $("#button").click(function () {
            var title=$("[name=\"title\"]").val();
            var tid=$("[name=\"city\"]").val();
            var status=$("[name=\"switch\"]").val();
            var detail=$("[name=\"desc\"]").val();
            $.get("blog/updateByBlogId",{
                "blogid":blogid,
                "title":title,
                "tid":tid,
                "status":status,
                "detail":detail
            },function (rs) {
                var mess = rs.result;
                alert(mess)
            })
        })
    });
</script>
</html>